home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple II Magazines (PO)
/
Nibble Volume 10, No. 03 (1989-03)(MicroSPARC)(Side A)[a].zip
/
Nibble Volume 10, No. 03 (1989-03)(MicroSPARC)(Side A)[a].po
/
SUPER.CURSOR.S
< prev
next >
Wrap
Text File
|
1996-12-24
|
5KB
|
174 lines
****************************
* SUPER.CURSOR SOURCE CODE *
* BY PAUL MEYERS *
* COPYRIGHT (C) 1989 *
* MICROSPARC, INC. *
* CONCORD, MA 01742 *
* MERLIN ASSEMBLER *
****************************
CH = $24 ;Cursor horizontal
BASL = $28 ;Location of cursor on creen
RNDL = $4E ;Random seed
RNDH = $4F
OURCH = $57B ;80 column CH
DOSKSW = $9EBA ;DOS's jump to the KSW
VECTIN = $BE32 ;ProDOS's input address
MLI = $BF00
KEY = $C000
STROBE = $C010
COL80 = $C01F
TEXT1 = $C054
TEXT2 = $C055
COUT = $FDED
*
* The first part (init) will set up all the defaults
* and the vectors for both DOS 3.3 and ProDOS
*
ORG $2CE
INIT LDA #"_"
STA CHAR
LDA #$50
STA SPEED
STA FLASH?
STA CHANGE?
LDA MLI ;Check for ProDOS
CMP #76
BNE NOTPRO
LDA #MAINLOOP ;Set up for ProDOS
STA VECTIN
LDA #>MAINLOOP
STA VECTIN+1
RTS
NOTPRO LDA #$4C ;Set up for DOS 3.3
STA DOSKSW
LDA #MAINLOOP
STA DOSKSW+1
LDA #>MAINLOOP
STA DOSKSW+2
RTS
*
* The Mainloop's main job is to clean up the screen,
* check for the different types of cursor flashing. It also
* gets the screen character and replaces it with the cursor and
* vice versa.
*
MAINLOOP STA OLDCHAR
JSR CLEAN
PHA ;Store it for awhile
BIT FLASH? ;Check for flash
BMI NOFLASH ;Branch to right subroutine
BIT CHANGE? ;Are we changing the cursor?
BMI NOFLSH ;Yes
MAINLOOP1 LDA CHAR ;Get the cursor
JSR BLINK ;Blink it
BMI MAINLOOP2 ;A key was pressed
PLA ;Get the previous char
PHA ;Put it back
JSR BLINK ;Blink it
BPL MAINLOOP1 ;Still no key
MAINLOOP2 BMI CHECKS ;Get the char
NOFLSH LDY #3
NOFLSH1 LDA CHNGE,Y
STY YTEMP
JSR BLINK
BMI CHECKS
LDY YTEMP
DEY
BPL NOFLSH1
BMI NOFLSH
NOFLASH LDA CHAR
JSR BLINK
BPL NOFLASH
CHECKS LDA KEY ;Get the key
CMP #$FF ;Check for delete
BNE DONONE
PLA
JSR STORE
STA STROBE
LDA #$88 ;Backspace
JSR COUT
LDA #$A0
JSR COUT
LDA #$88
RTS
DONONE PLA
JSR STORE ;Put it on the screen
LDA KEY ;Get the character
STA STROBE ;Reset strobe
RTS
*
* Blink simply stores the accumulator's value onto the
* screen, checks for a key press, and increments
* the random number seed.
*
BLINK JSR STORE ;Store it on the screen
LDA SPEED ;Prepare to save the speed
STA WSPEED ;Into the Work SPEED
BLINK1 BIT KEY ;Check for key
BMI BLRET ;There was a key
INC RNDL ;Generate random seed
BNE BLINK1 ;Look for another key
INC RNDH
DEC WSPEED ;Decrement counter
BNE BLINK1
BLRET RTS
*
* Clean will clean up the incorrect screen
* and get a character from the screen, either
* page 1 or page 2 (80 columns).
*
CLEAN BIT COL80
BPL RETURN
LDY CH ;Clean up the monitor's
LDA OLDCHAR ;titanic attempt to
STA (BASL),Y ;flash the cursor
GET LDA OURCH ;Get the 80 col. CH
LSR ;Divide it by two
TAY
PHP ;Lock interupts while
SEI ;screen holes are wrong
BIT TEXT2 ;Assume page 2,
BCC GETCHAR ;evens
BIT TEXT1 ;Woops! page 1, odds
GETCHAR LDA (BASL),Y
BIT TEXT1 ;Set back to page1
PLP
RETURN RTS
*
* Store will store a character on either text
* screen.
*
STORE BIT COL80
BMI STORE80
LDY CH
STA (BASL),Y
RTS
STORE80 PHA
LDA OURCH
LSR
TAY
PLA
PHP
SEI
BIT TEXT2
BCC STOREIT
BIT TEXT1
STOREIT STA (BASL),Y
BIT TEXT1
PLP
RTS
CHAR HEX 00
SPEED HEX 00
FLASH? HEX 00
CHANGE? HEX 00
WSPEED HEX 50
OLDCHAR HEX 00
YTEMP HEX 00
CHNGE ASC "\-/|" ;Twirl characters
LST OFF